package com.example.log.listener;

import com.alibaba.fastjson.JSONObject;
import com.example.log.entity.OperationLog;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.connection.MessageListener;
import org.springframework.stereotype.Component;


@Slf4j
@Component
public class LogSubscribeMessage implements MessageListener {

    @Override
    public void onMessage(Message message, byte[] bytes) {
        OperationLog operationLog = JSONObject.parseObject(message.toString(), OperationLog.class);
        log.info("operationLog_subcribe : {}", operationLog);
    }
}